<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title> 1-9 JavaScript-什么是函数</title>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <script type="text/javascript">
        function contxt() //定义函数
        {
            alert("哈哈！函数调用了！");
        }
        function add2() {
            var sum = 2 + 3;
            alert(sum);
        }
    </script>
</head>

<body>
<div align="center">
    <p><a href="../index.php#js" class="fontSize" title="点击进入该目录">目录</a></p>
</div>

<div style="margin: 0 auto;width: 300px;height:200px ;">
    <input type="button" value="点击我" onclick="contxt()"/>
    <input type="button" value="2+3=?" onclick="add2()"/>
    <!--点击按钮后,调用函数,onclick为点击事件.-->
</div>
</body>
</html>
